package com.sky.controller.admin;

import com.sky.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;

/**
 * @Author by 孙有泽
 * @Date 2025/3/5 20:46
 * @Description 管理店铺管理
 */

@RestController("adminShopController")
@RequestMapping("/admin/shop")
@Api(tags = "店铺管理")
public class ShopController {

    private  static final  String key="SHOP_STATUS";
    @Autowired
    private RedisTemplate redisTemplate;

    /*
     * @author 孙有泽
     * @date 2025/3/5 21:12
     * @description 店铺状态的修改
     */
    @ApiOperation(value = "店铺状态的修改")
    @PutMapping("/{status}")
    public Result updateStatus(@PathVariable Integer status){
        redisTemplate.opsForValue().set(key,status);
        return Result.success();
    }
    /*
     * @author 孙有泽
     * @date 2025/3/5 21:12
     * @description 店铺状态的查询
     */
    @ApiOperation(value = "店铺状态的查询")
    @GetMapping("/status")
    public Result getStatus(){
        Integer status = (Integer) redisTemplate.opsForValue().get(key);
        return Result.success(status);

    }


}
